<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>rrdruby</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body>



<h1 id="NAME">NAME</h1>

<p>rrdruby - About the RRD Ruby bindings</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<pre><code> require &quot;RRD&quot;
 RRD.create(
    rrd,
    &quot;--step&quot;, &quot;300&quot;,
    &quot;DS:a:GAUGE:600:U:U&quot;,
    &quot;DS:b:GAUGE:600:U:U&quot;,
    &quot;RRA:AVERAGE:0.5:1:300&quot;)</code></pre>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>The <b>rrdtool</b> functions are directly callable via the Ruby programming language. This wrapper implementation has been written from the scratch (without SWIG)</p>

<p>The API simply expects string parameters to the functions. Please refer to the other <b>rrdtool</b> documentation for functions and valid arguments.</p>

<h1 id="EXAMPLE">EXAMPLE</h1>

<pre><code> $: &lt;&lt; &#39;/path/to/rrdtool/lib/ruby/1.8/i386-linux&#39;
 require &quot;RRD&quot;

 name = &quot;test&quot;
 rrd = &quot;#{name}.rrd&quot;
 start = Time.now.to_i

 RRD.create(
    rrd,
    &quot;--start&quot;, &quot;#{start - 1}&quot;,
    &quot;--step&quot;, &quot;300&quot;,
        &quot;DS:a:GAUGE:600:U:U&quot;,
    &quot;DS:b:GAUGE:600:U:U&quot;,
    &quot;RRA:AVERAGE:0.5:1:300&quot;)
 puts

 puts &quot;updating #{rrd}&quot;
 start.to_i.step(start.to_i + 300 * 300, 300) { |i|
    RRD.update(rrd, &quot;#{i}:#{rand(100)}:#{Math.sin(i / 800) * 50 + 50}&quot;)
 }
 puts

 puts &quot;fetching data from #{rrd}&quot;
 (fstart, fend, data, step) = RRD.fetch(rrd, &quot;--start&quot;, start.to_s, &quot;--end&quot;,
      (start + 300 * 300).to_s, &quot;AVERAGE&quot;)
 puts &quot;got #{data.length} data points from #{fstart} to #{fend}&quot;
 puts

 puts &quot;generating graph #{name}.png&quot;
 RRD.graph(
   &quot;#{name}.png&quot;,
    &quot;--title&quot;, &quot; RubyRRD Demo&quot;,
    &quot;--start&quot;, &quot;#{start+3600}&quot;,
    &quot;--end&quot;, &quot;start + 1000 min&quot;,
    &quot;--interlaced&quot;,
    &quot;--imgformat&quot;, &quot;PNG&quot;,
    &quot;--width=450&quot;,
    &quot;DEF:a=#{rrd}:a:AVERAGE&quot;,
    &quot;DEF:b=#{rrd}:b:AVERAGE&quot;,
    &quot;CDEF:line=TIME,2400,%,300,LT,a,UNKN,IF&quot;,
    &quot;AREA:b#00b6e4:beta&quot;,
    &quot;AREA:line#0022e9:alpha&quot;,
    &quot;LINE3:line#ff0000&quot;)
 puts</code></pre>

<p>If you use the <b>--ruby-site-install</b> configure option you can drop the $: line since the RRDtool module will be found automatically.</p>

<p>If RRDtool runs into trouble, it will throw an exception which you might want to catch.</p>

<h1 id="SEE-ALSO">SEE ALSO</h1>

<p>rrdcreate, rrdupdate, rrdgraph, rrddump, rrdfetch, rrdtune, rrdlast, rrdxport, rrdinfo</p>

<h1 id="AUTHOR">AUTHOR</h1>

<p>Lo&iuml;s Lherbier &lt;lois.lherbier@covadis.ch&gt;</p>

<p>Miles Egan &lt;miles@caddr.com&gt;</p>


</body>

</html>


